package com.engine4cloud.tdf.supervision.feign;

import com.engine4cloud.tdf.common.core.constant.SecurityConstants;
import com.engine4cloud.tdf.common.core.constant.ServiceNameConstants;
import com.engine4cloud.tdf.common.core.util.R;
import com.engine4cloud.tdf.common.data.web.response.PageInfo;
import com.engine4cloud.tdf.common.data.web.response.Params;
import com.engine4cloud.tdf.supervision.dto.SpOutApplicationVerifyDTO;
import com.engine4cloud.tdf.supervision.dto.create.SpOutApplicationCreateDTO;
import com.engine4cloud.tdf.supervision.dto.query.SpOutApplicationQueryDTO;
import com.engine4cloud.tdf.supervision.dto.result.SpOutApplicationResultDTO;
import com.engine4cloud.tdf.supervision.dto.update.SpOutApplicationUpdateDTO;
import jakarta.validation.Valid;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.List;


/**
 * 审批-外出申请管理
 *
 * @author sh
 * @date 2024-08-02 15:07:07
 */
@FeignClient(contextId = "RemoteSpOutApplicationService", value = ServiceNameConstants.SUPERVISION_SERVER)
public interface RemoteSpOutApplicationService {

    /**
     * 分页查询
     *
     * @param page 分页对象
     * @param dto  外出申请信息采集表-请求对象
     * @return R<PageInfo < SpOutApplicationResultDTO>>
     */
    @GetMapping("/inner/out/page")
    R<PageInfo<SpOutApplicationResultDTO>> pageList(@RequestParam("page") Params page, @Valid @RequestParam("dto") SpOutApplicationQueryDTO dto,
                                                    @RequestHeader(SecurityConstants.FROM) String from);

    /**
     * 通过id查询外出申请信息采集表
     *
     * @param id id
     * @return R
     */
    @GetMapping("/inner/out/{id}")
    R<SpOutApplicationResultDTO> getById(@PathVariable("id") Long id, @RequestHeader(SecurityConstants.FROM) String from);

    /**
     * 查询矫正对象外出申请信息
     *
     * @return R
     */
    @PostMapping("/inner/out/list")
    R<List<SpOutApplicationResultDTO>> findListByPreActions(@Valid @RequestBody SpOutApplicationVerifyDTO dto, @RequestHeader(SecurityConstants.FROM) String from);

    /**
     * 创建外出申请
     *
     * @param dto 创建外出申请
     * @return R
     */
    @PostMapping("/inner/out")
    R<Boolean> create(@Valid @RequestBody SpOutApplicationCreateDTO dto, @RequestHeader(SecurityConstants.FROM) String from);

    /**
     * 修改外出申请
     *
     * @param dto 修改外出申请
     * @return R
     */
    @PutMapping("/inner/out")
    R<Boolean> updateById(@Valid @RequestBody SpOutApplicationUpdateDTO dto, @RequestHeader(SecurityConstants.FROM) String from);
}
